<?php

/**
 * VTNSDocument form base class.
 *
 * @method VTNSDocument getObject() Returns the current form's model object
 *
 * @package    vtns
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseVTNSDocumentForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'document_id'          => new sfWidgetFormInputHidden(),
      'name'                 => new sfWidgetFormInputText(),
      'document_category_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('VTNSDocumentCategory'), 'add_empty' => true)),
      'file'                 => new sfWidgetFormTextarea(),
      'file_size'            => new sfWidgetFormTextarea(),
      'file_type'            => new sfWidgetFormTextarea(),
      'description'          => new sfWidgetFormTextarea(),
      'content'              => new sfWidgetFormTextarea(),
      'views_count'          => new sfWidgetFormInputText(),
      'is_active'            => new sfWidgetFormInputText(),
      'created_at'           => new sfWidgetFormDateTime(),
      'updated_at'           => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'document_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('document_id')), 'empty_value' => $this->getObject()->get('document_id'), 'required' => false)),
      'name'                 => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'document_category_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('VTNSDocumentCategory'), 'required' => false)),
      'file'                 => new sfValidatorString(array('required' => false)),
      'file_size'            => new sfValidatorString(array('required' => false)),
      'file_type'            => new sfValidatorString(array('required' => false)),
      'description'          => new sfValidatorString(array('required' => false)),
      'content'              => new sfValidatorString(array('required' => false)),
      'views_count'          => new sfValidatorInteger(array('required' => false)),
      'is_active'            => new sfValidatorInteger(array('required' => false)),
      'created_at'           => new sfValidatorDateTime(),
      'updated_at'           => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('vtns_document[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'VTNSDocument';
  }

}
